How to select a camera for Quicktime in Applescript?

ElCap 10.11.5 (15F34)


I'm trying to automate a screen recording of one of several iPhones we're running tests on in parallel (using several robot users on the same machine).

Since Quicktime sadly only supports one user recording at a time (even if I start a Desktop for each), I have to tell it to record the iPhone allocated to the user with the desktop, but I'm struggling with that:


tell application "QuickTime Player"

repeat with i from 1 to (get video recording devices count)

set d to (get video recording devicei)

set n to (get name of d)

# Doesn't get this far.

# if item 1 of argv is equal to n then

# tell recording to set current camera to d

# end if

end repeat

end tell

The error is

QuickTime Player got an error: Can’t make screen compression preset "[A][***] 670-53 81:ie iPhone 5c 8Gb Blue" into type specifier.

....which is really annoying, dangling the very information I want right in front of me. I'm tempted to rig something involving capturing and parsing the error message, but that would be evil. I find it really hard to code in languages that hide or obscure their type information, but expect you to know what's going on.


'Script Debugger' says the offending AEPrint looks like this, in case it helps:

'obj '{

'form':'name',

'want':',

'seld':'utxt'("[A][***] 670-53 81:ie iPhone 5c 8Gb Blue"),

'from':[

0x0,

ab0ab "QuickTime Player"

]

}


Firstly, what magical incantation should I be using for this?


Secondly, why isn't what seems like the obvious thing to do, working?


Thanks.

Posted on Jun 28, 2016 3:29 PM

Reply
2 replies

Jun 28, 2016 4:16 PM in response to sleekweasel

I've made slight progress:


tell application "QuickTime Player" to set n to (name of video recording devicei as text)

seems to give me the name usefully enough to check whether 'item 1 of argv' is in it, but then setting the camera to 'd' doesn't work, complaining with

error "QuickTime Player got an error: Can’t make screen compression preset \"[A][***] 670-53 81:ie iPhone 5c 8Gb Blue\" into type specifier." number -1700 fromscreen compression preset "[A][***] 670-53 81:ie iPhone 5c 8Gb Blue" tospecifier

...which suggests that a 'video recording device' isn't a camera, despite the documentation saying

current camera (video recording device) : The currently previewing video device.

and my having 'set d to (get video recording device i)'.

Any clues welcome.

Jun 29, 2016 12:47 AM in response to sleekweasel

Seems that 'It just doesn't work': this script records with whatever camera was set last.

I would love to hear from anyone who can explain just what is going on, or suggest an alternative.

tell application "QuickTime Player"

activate

close every windowsavingno

repeat with i from 1 to (get video recording devicescount)

set n to (name of video recording devicei as text)

if "[A][***] 670-53 81:ie iPhone 5c 8Gb Blue" is in n then


log (get video recording devicei)

set newRecording to new movie recording

set current camera of newRecording to video recording devicei


startnewRecording

end if

end repeat

end tell

This thread has been closed by the system or the community team. You may vote for any posts you find helpful, or search the Community for additional answers.

How to select a camera for Quicktime in Applescript?

Welcome to Apple Support Community
A forum where Apple customers help each other with their products. Get started with your Apple Account.